﻿using System;
using UnityEngine.UI;

namespace SizeboxUI
{
	// Token: 0x020003AA RID: 938
	public class AudioSettingsView : SettingsView
	{
		// Token: 0x060018B4 RID: 6324 RVA: 0x0009BBC0 File Offset: 0x00099DC0
		private void Start()
		{
			base.GetComponentInChildren<Text>().text = "Audio";
			this.master = base.AddSlider("Master", -80f, 0f);
			this.master.onValueChanged.AddListener(delegate(float v)
			{
				this.OnMasterChanged(v, true);
			});
			this.background = base.AddSlider("Background", -80f, 0f);
			this.background.onValueChanged.AddListener(delegate(float v)
			{
				this.OnBackgroundChanged(v, true);
			});
			this.destruction = base.AddSlider("Destruction", -80f, 0f);
			this.destruction.onValueChanged.AddListener(delegate(float v)
			{
				this.OnDestructionChanged(v, true);
			});
			this.effects = base.AddSlider("Effects", -80f, 0f);
			this.effects.onValueChanged.AddListener(delegate(float v)
			{
				this.OnEffectsChanged(v, true);
			});
			this.macro = base.AddSlider("Macros", -80f, 0f);
			this.macro.onValueChanged.AddListener(delegate(float v)
			{
				this.OnMacroChanged(v, true);
			});
			this.micro = base.AddSlider("Micros", -80f, 0f);
			this.micro.onValueChanged.AddListener(delegate(float v)
			{
				this.OnMicroChanged(v, true);
			});
			this.voice = base.AddSlider("Voice", -80f, 0f);
			this.voice.onValueChanged.AddListener(delegate(float v)
			{
				this.OnVoiceChanged(v, true);
			});
			this.windA = base.AddSlider("Ambient Wind", -80f, 0f);
			this.windG = base.AddSlider("Giantess Wind", -80f, 0f);
			this.windA.value = GlobalPreferences.VolumeWindA.value;
			this.windG.value = GlobalPreferences.VolumeWindG.value;
			this.windA.onValueChanged.AddListener(delegate(float v)
			{
				this.OnWindAChanged(v, true);
			});
			this.windG.onValueChanged.AddListener(delegate(float v)
			{
				this.OnWindGChanged(v, true);
			});
			this.raygun = base.AddSlider("Raygun Effects", -80f, 0f);
			this.raygun.onValueChanged.AddListener(delegate(float v)
			{
				this.OnRaygunChanged(v, true);
			});
			this.aiGuns = base.AddSlider("AI Gun Effects", -80f, 0f);
			this.aiGuns.onValueChanged.AddListener(delegate(float v)
			{
				this.OnAIGunsChanged(v, true);
			});
			this.backgroundAudio = base.AddToggle("Play Audio when unfocused");
			this.backgroundAudio.onValueChanged.AddListener(delegate(bool v)
			{
				this.OnUnfocusMuteChanged(v);
			});
			this.UpdateValues();
			this.initialized = true;
		}

		// Token: 0x060018B5 RID: 6325 RVA: 0x0009BE9E File Offset: 0x0009A09E
		private void OnUnfocusMuteChanged(bool value)
		{
			GlobalPreferences.BackgroundAudio.value = value;
		}

		// Token: 0x060018B6 RID: 6326 RVA: 0x0009BEAB File Offset: 0x0009A0AB
		private void OnMasterChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Master", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeMaster.value = val;
			}
		}

		// Token: 0x060018B7 RID: 6327 RVA: 0x0009BEDF File Offset: 0x0009A0DF
		private void OnBackgroundChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Background", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeBackground.value = val;
			}
		}

		// Token: 0x060018B8 RID: 6328 RVA: 0x0009BF13 File Offset: 0x0009A113
		private void OnDestructionChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Destruction", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeDestruction.value = val;
			}
		}

		// Token: 0x060018B9 RID: 6329 RVA: 0x0009BF47 File Offset: 0x0009A147
		private void OnEffectsChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Effects", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeEffect.value = val;
			}
		}

		// Token: 0x060018BA RID: 6330 RVA: 0x0009BF7B File Offset: 0x0009A17B
		private void OnMacroChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Macro", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeMacro.value = val;
			}
		}

		// Token: 0x060018BB RID: 6331 RVA: 0x0009BFAF File Offset: 0x0009A1AF
		private void OnMicroChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Micro", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeMicro.value = val;
			}
		}

		// Token: 0x060018BC RID: 6332 RVA: 0x0009BFE3 File Offset: 0x0009A1E3
		private void OnVoiceChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Voice", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeVoice.value = val;
			}
		}

		// Token: 0x060018BD RID: 6333 RVA: 0x0009C017 File Offset: 0x0009A217
		private void OnWindAChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("WindA", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeWindA.value = val;
			}
		}

		// Token: 0x060018BE RID: 6334 RVA: 0x0009C04B File Offset: 0x0009A24B
		private void OnWindGChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("WindG", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeWindG.value = val;
			}
		}

		// Token: 0x060018BF RID: 6335 RVA: 0x0009C07F File Offset: 0x0009A27F
		private void OnRaygunChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("Raygun", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeRaygun.value = val;
			}
		}

		// Token: 0x060018C0 RID: 6336 RVA: 0x0009C0B3 File Offset: 0x0009A2B3
		private void OnAIGunsChanged(float val, bool write = false)
		{
			if (SoundManager.This != null)
			{
				SoundManager.Mixer.SetFloat("AIGuns", val);
			}
			if (write)
			{
				GlobalPreferences.VolumeAIGuns.value = val;
			}
		}

		// Token: 0x060018C1 RID: 6337 RVA: 0x0009C0E8 File Offset: 0x0009A2E8
		protected override void UpdateValues()
		{
			if (SoundManager.This != null)
			{
				this.backgroundAudio.isOn = GlobalPreferences.BackgroundAudio.value;
				float value = 0f;
				SoundManager.Mixer.GetFloat("Master", out value);
				this.master.value = value;
				SoundManager.Mixer.GetFloat("Background", out value);
				this.background.value = value;
				SoundManager.Mixer.GetFloat("Destruction", out value);
				this.destruction.value = value;
				SoundManager.Mixer.GetFloat("Effects", out value);
				this.effects.value = value;
				SoundManager.Mixer.GetFloat("Macro", out value);
				this.macro.value = value;
				SoundManager.Mixer.GetFloat("Micro", out value);
				this.micro.value = value;
				SoundManager.Mixer.GetFloat("Voice", out value);
				this.voice.value = value;
				SoundManager.Mixer.GetFloat("Raygun", out value);
				this.raygun.value = value;
				SoundManager.Mixer.GetFloat("AIGuns", out value);
				this.aiGuns.value = value;
				this.windA.value = GlobalPreferences.VolumeWindA.value;
				this.windG.value = GlobalPreferences.VolumeWindG.value;
			}
			else
			{
				this.backgroundAudio.isOn = GlobalPreferences.BackgroundAudio.value;
				this.master.value = GlobalPreferences.VolumeMaster.value;
				this.background.value = GlobalPreferences.VolumeBackground.value;
				this.destruction.value = GlobalPreferences.VolumeDestruction.value;
				this.effects.value = GlobalPreferences.VolumeEffect.value;
				this.macro.value = GlobalPreferences.VolumeMacro.value;
				this.micro.value = GlobalPreferences.VolumeMicro.value;
				this.voice.value = GlobalPreferences.VolumeVoice.value;
				this.windA.value = GlobalPreferences.VolumeWindA.value;
				this.windG.value = GlobalPreferences.VolumeWindG.value;
				this.raygun.value = GlobalPreferences.VolumeRaygun.value;
				this.aiGuns.value = GlobalPreferences.VolumeAIGuns.value;
			}
		}

		// Token: 0x04001AD6 RID: 6870
		private Slider master;

		// Token: 0x04001AD7 RID: 6871
		private Slider background;

		// Token: 0x04001AD8 RID: 6872
		private Slider destruction;

		// Token: 0x04001AD9 RID: 6873
		private Slider effects;

		// Token: 0x04001ADA RID: 6874
		private Slider macro;

		// Token: 0x04001ADB RID: 6875
		private Slider micro;

		// Token: 0x04001ADC RID: 6876
		private Slider voice;

		// Token: 0x04001ADD RID: 6877
		private Slider windA;

		// Token: 0x04001ADE RID: 6878
		private Slider windG;

		// Token: 0x04001ADF RID: 6879
		private Slider raygun;

		// Token: 0x04001AE0 RID: 6880
		private Slider aiGuns;

		// Token: 0x04001AE1 RID: 6881
		private Toggle backgroundAudio;
	}
}
